package uz.edo.app.client.ui.doc;

import org.apache.wicket.extensions.markup.html.form.DateTextField;
import org.apache.wicket.markup.html.form.Form;

import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;
import uz.edo.app.client.MyPage;
import uz.edo.db.bean.Registrationdoc;
import uz.edo.db.manager.RegistrationdocManager;

public class RegistrationDocEdit extends MyPage{
    private RegistrationdocManager manager = RegistrationdocManager.getInstance();

    @SuppressWarnings("unchecked")
	public RegistrationDocEdit(final Registrationdoc registrationdoc) {
        CompoundPropertyModel model = new CompoundPropertyModel(registrationdoc);
        Form form = new Form("form",model){
		private static final long serialVersionUID = -2685688341507687047L;
		@Override
        protected void onSubmit() {
        try {
	    manager.update(registrationdoc);
	    setResponsePage(DocListView.class);
        }
        catch (Exception e) {
        e.printStackTrace();
        }
        }
        };
        add(form);
        form.add(new TextField("personfio"));
        form.add(new TextField("murojaatDescription"));
        form.add(new DateTextField("murojaatDate", "dd.MM.yyyy"));
    }
}
